package com.wteam.controller;


import com.wteam.PoJo.DTO.PageQuery;
import com.wteam.PoJo.VO.ReplyCommentVO;
import com.wteam.Service.ILikesService;
import com.wteam.until.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-07-16
 */
@RestController
@RequestMapping("/likes")
public class LikesController {

    @Autowired
    private ILikesService iLikesService;

    @GetMapping("/likepostwork/{id}")
    @ApiOperation("给帖子点赞")
    public Result likepostwork(@PathVariable @ApiParam("帖子id") Long id) {
        return iLikesService.likepostwork(id);
    }

    @DeleteMapping ("/likepostwork/{id}")
    @ApiOperation("取消帖子点赞")
    public Result cannlelikepost(@PathVariable @ApiParam("帖子id") Long id) {
        return iLikesService.cannlelikepost(id);
    }

    @GetMapping("/likecomment/{id}/{type}")
    @ApiOperation("给评论或回复点赞")
    public Result likecomment(@PathVariable @ApiParam("评论表id或者回复表id") Long id,
                              @PathVariable@ApiParam("1：填评论表id:2：填回复表id")Integer type) {
        return iLikesService.likecomment(id,type);
    }
    @DeleteMapping("/likecomment/{id}/{type}")
    @ApiOperation("取消给评论或者回复点赞")
    public Result cannlelikecomment(@PathVariable @ApiParam("评论表id或者回复表id") Long id,
                              @PathVariable@ApiParam("1：填评论表id:2：填回复表id")Integer type) {
        return iLikesService.cannlelikecomment(id,type);
    }
}
